<script setup>
    import {ref, computed} from "vue"
    // 计算属性练习
    const firstName = ref("Emily")
    const lastName = ref("Ford")

    const fullName = computed({
      get() {
        return firstName.value + lastName.value
      },
      set (newVal) {
        const names = newVal.split(" ")
        firstName.value = names[0]
        lastName.value = names[1]
    }})
</script>

<template>
  <div>
    <p>姓名：{{ fullName }}</p>
  </div>
</template>

<style scoped>

</style>